package com.uetoken.cn.fragment;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.uetoken.cn.R;
import com.uetoken.cn.adapter.DenominationAdapter;
import com.uetoken.cn.adapter.model.DenominationModel;
import com.uetoken.cn.base.BaseFragment;
import com.uetoken.cn.manager.UEDataManager;
import com.uetoken.cn.view.pagerecyclerview.SpacesItemDecoration;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;

public class NotShipmentFragment extends BaseFragment {

    @BindView(R.id.notShipmentScrollView)
    ScrollView mNotShipmentScrollView;
    @BindView(R.id.walletNameTv)
    TextView walletNameTv;
    @BindView(R.id.amountTv)
    TextView amountTv;
    @BindView(R.id.freezeLimitTv)
    TextView freezeLimitTv;
    @BindView(R.id.topCapitalLayout)
    RelativeLayout topCapitalLayout;

    @BindView(R.id.selectDenominationTv)
    TextView selectDenominationTv;
    @BindView(R.id.denominationRecyclerView)
    RecyclerView mDenominationRecyclerView;
    @BindView(R.id.denominationLayout)
    RelativeLayout denominationLayout;
    @BindView(R.id.oppositeAccountNumberTv)
    TextView oppositeAccountNumberTv;
    @BindView(R.id.accountNumberEt)
    EditText mAccountNumberEt;
    @BindView(R.id.checkAccountBtn)
    Button checkAccountBtn;
    @BindView(R.id.oppositeAccountNumberLayout)
    RelativeLayout oppositeAccountNumberLayout;
    @BindView(R.id.line1)
    View line1;
    @BindView(R.id.annotationTv)
    TextView annotationTv;
    @BindView(R.id.detailsTv)
    TextView detailsTv;
    @BindView(R.id.detailsLayout)
    RelativeLayout detailsLayout;
    @BindView(R.id.transferLayout)
    RelativeLayout transferLayout;
    @BindView(R.id.verifyBindBtn)
    Button verifyBindBtn;

    private DenominationAdapter mDenominationAdapter;
    private List<DenominationModel> mDenominationModelList;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_not_shipment, container, false);
        ButterKnife.bind(this, view);
        initView();
        initData();
        return view;
    }

    private void initView() {
//        mNotShipmentScrollView.fullScroll(ScrollView.)
        mDenominationRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
        //设置分隔线
        int spacingInPixels = getResources().getDimensionPixelSize(R.dimen.album_dp_15);
        mDenominationRecyclerView.addItemDecoration(new SpacesItemDecoration(0, 0, spacingInPixels, 0));
    }

    private void initData() {
        getDenomination();
    }

    private void getDenomination() {
        mDenominationModelList = new ArrayList<>();

        DenominationModel model1 = new DenominationModel();
        model1.setDenomination(100);
        model1.setQuantity(0);
        DenominationModel model2 = new DenominationModel();
        model2.setDenomination(500);
        model2.setQuantity(0);
        DenominationModel model3 = new DenominationModel();
        model3.setDenomination(1000);
        model3.setQuantity(0);
        DenominationModel model4 = new DenominationModel();
        model4.setDenomination(5000);
        model4.setQuantity(0);
        DenominationModel model5 = new DenominationModel();
        model5.setDenomination(10000);
        model5.setQuantity(0);

        mDenominationModelList.add(model1);
        mDenominationModelList.add(model2);
        mDenominationModelList.add(model3);
        mDenominationModelList.add(model4);
        mDenominationModelList.add(model5);

        mDenominationAdapter = new DenominationAdapter(getActivity(), null);
        UEDataManager.getInstance().setDenominationModelList(mDenominationModelList);
        mDenominationRecyclerView.setAdapter(mDenominationAdapter);

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }
}
